import { Controller, Post, Body, Patch } from "@nestjs/common";
import { ApiBearerAuth, ApiBody, ApiOperation, ApiResponse, ApiTags } from "@nestjs/swagger";
import { CourseService } from "./course.service";
import { CreateCourseDto } from "./dto/create-course.dto";
import { UpdateCourseDto } from "./dto/update-course.dto";

@Controller("/school/course")
@ApiTags("课程相关")
export class CourseController {
  constructor(private readonly courseService: CourseService) {}

  @Post()
  @ApiOperation({ summary: "新增班级课表", description: "新增班级课表" })
  @ApiResponse({ status: 200, description: "success" })
  @ApiBody({ type: CreateCourseDto })
  @ApiBearerAuth()
  create(@Body() createCourseDto: CreateCourseDto) {
    return this.courseService.create(createCourseDto);
  }

  @Patch()
  @ApiOperation({ summary: "更新班级课表", description: "更新班级课表" })
  @ApiResponse({ status: 200, description: "success" })
  @ApiBody({ type: UpdateCourseDto })
  @ApiBearerAuth()
  update(@Body() updateCourseDto: UpdateCourseDto) {
    return this.courseService.update(updateCourseDto);
  }
}
